<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'sushu.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<link rel="stylesheet" type="text/css" href="css/index.css">
	
	<script>
	alert("大家看，王世成的头像牛逼不？");
	</script>
  </head>
  
  <body>
  <%!
  //判断是否是质数
   boolean isZhishu(int m){
	  if(m==1)return false;
	  for(int i=2,k=(int)(Math.sqrt(m));i<=k;i++){
		  if(m%i==0)
			  return false;//不是质数
	  }
	  return true;
  }
  %>
    <h1>1-100素数和</h1>
    <%
    int sum=0;
     for( int i=1;i<=100;i++){
    	 sum+=(isZhishu(i)?i:0);
     }
    %>
    <h1><%-- <%
    	System.out.println(sum);
    %> --%>
    <%=sum%>
    </h1>
    <img src="img/school.jpg" alt="运动会图片" height="300px" width="400px"/>
  </body>
</html>
